<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 00:33:05
 * @LastEditTime: 2023-11-02 13:21:52
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: BOM成品工艺
 */

namespace App\Models;

use App\Traits\MaterialTrait;
use App\Traits\StorageTrait;
use App\Traits\CarTrait;
use App\Traits\CarryTrait;

class ProOutsourcingDeliveryPack extends BaseModel
    {
    use MaterialTrait;
    use StorageTrait;
    public $timestamps = true;
    public $table = "sys_pro_outsourcing_delivery_pack";
    protected $guarded = [];

    public function getPaperCode()
        {
        return $this->main->code;
        }
    public function main()
        {
        return $this->belongsTo(ProOutsourcingDelivery::class);
        }
    public function detail()
        {
        return $this->belongsTo(ProOutsourcingDeliveryDetail::class);
        }
    public function outfactory()
        {
        return $this->belongsTo(Company::class);
        }
    
    public function new_mpc_detail()
        {
        return $this->belongsTo(MpcSummaryDetail::class);
        }
    public function getSourceAddr()
        {
        return $this->location->name;
        }
    //运输派车目的地址
    public function getTargetAddr()
        {
        return $this->outfactory->name;
        }
    public function summary_storage()
        {
        return $this->belongsTo(MpcSummaryStorage::class);
        }
    public function purchase_storage()
        {
        return $this->belongsTo(PurchaseStorageDetails::class, "relation_id");
        }
    }
